{template 'common/header'}
<script language="JavaScript" src="{MODULE_URL}template/public/js/delete.js"></script>
<ol class="breadcrumb we7-breadcrumb">
    <a href="{php echo $this->createWebUrl('teacher');}"><i class="wi wi-back-circle"></i> </a>
    <li>
        <a href="{php echo $this->createWebUrl('teacher');}">教师列表</a>
    </li>
    <li>
        编辑教师
    </li>
</ol>
<script>
    function onsubmitForm() {
        var teacher_name = $("input[name='teacher_name']").val();
        if (teacher_name == null || teacher_name == "") {
            alert("请填写教师姓名");
            $("input[name='teacher_name']").focus();
            return false;
        }

        var teacher_intro = $("textarea[name='teacher_intro']").val();
        if (teacher_intro == null || teacher_intro == "") {
            alert("请填写教师简介");
            $("textarea[name='teacher_intro']").focus();
            return false;
        }
    }
</script>
<div class="panel panel-default">
    <div class="panel-heading">编辑教师</div>
    <div class="panel-body">
        <form class="form-horizontal" role="form" action="#" method="POST" onsubmit="return onsubmitForm();">
            <!--表单开始-->
            <div class="form-group">
                <label class="col-sm-2 control-label">教师姓名</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" name="teacher_name" value="{$teacher['teacher_name']}" placeholder="请填写教师姓名"/>
                    <div class="help-block">教师姓名</div>
                </div>
            </div>
            <!--表单结束-->

            <!--表单开始-->
            <!--<div class="form-group">-->
            <!--<label class="col-sm-2 control-label">教师类型</label>-->
            <!--<div class="col-sm-8">-->

            <!--<label class="radio-inline">-->
            <!--<input type="radio" name="teacher_type" id="inlineRadio1" value="1" {if $teacher['teacher_type']=='1'}checked="checked"{else}{/if}>业务老师-->
            <!--</label>-->
            <!--<label class="radio-inline">-->
            <!--<input type="radio" name="teacher_type" id="inlineRadio2" value="2" {if $teacher['teacher_type']=='2'}checked="checked"{else}{/if}>咨询老师-->
            <!--</label>-->

            <!--<span class="help-block">教师类型</span>-->
            <!--</div>-->
            <!--</div>-->
            <!--表单结束-->

            <!--表单开始-->
            <div class="form-group">
                <label class="col-sm-2 control-label">擅长领域</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" name="teacher_specialty" value="{$teacher['teacher_specialty']}" placeholder="请填写教师擅长领域"/>
                    <div class="help-block">擅长领域</div>
                </div>
            </div>
            <!--表单结束-->

            <!--表单开始-->
            <div class="form-group">
                <label class="col-sm-2 control-label">教师简介</label>
                <div class="col-sm-8">
                    <textarea class="form-control" rows="5" name="teacher_intro">{$teacher['teacher_intro']}</textarea>

                    <span class="help-block">请填写教师简介</span>
                </div>
            </div>
            <!--表单结束-->

            <!--表单开始-->
            <div class="form-group">
                <label class="col-sm-2 control-label">绑定会员</label>
                <div class="col-sm-8">

                    <select class="form-control" name="openid">
                        <option value="" selected="selected">请选择老师</option>
                        {loop $user $key $user}
                        {if $user['openid']==$teacher['openid']}
                        <option value="{$user['openid']}" selected="selected">{$user['nickname']}</option>
                        {else}
                        <option value="{$user['openid']}">{$user['nickname']}</option>
                        {/if}
                        {/loop}
                    </select>

                    <span class="help-block">绑定会员</span>
                </div>
            </div>
            <!--表单结束-->

            <!--表单开始-->
            {if !empty($teacher['teacher_avatar'])}
            <div class="row">
                <div class="col-sm-2"></div>
                <div class="col-sm-8">
                    <img style='width:100px;height:140px;' src="{$_W['attachurl']}{$teacher['teacher_avatar']}" class="img-thumbnail old-pic">
                    <span class="help-block">重新上传会替换该图片</span>
                </div>
            </div>
            {else}{/if}
            <!--表单结束-->

            <!--表单开始-->
            <div class="form-group">
                <label class="col-sm-2 control-label">教师图片</label>
                <div class="col-sm-8">
                    {php echo tpl_form_field_image('teacher_avatar');}
                    <span class="help-block">教师图片</span>

                </div>
            </div>
            <!--表单结束-->

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <input class="btn btn-default" type="submit" name="submit" value="提 交">

                </div>
            </div>
            <input type="hidden" name="token" value="{$_W['token']}"/>
            <input type="hidden" name="avatar_old" value="{$teacher['teacher_avatar']}"/>
        </form>
    </div>
</div>
{template 'common/footer'}
